import React, { Component } from 'react';
import styles from "./style.less";
import { Icon } from 'antd';
import { connect } from 'dva';
import ResizTable from "./../../../components/Table/table";
import ListDetailPage from './../../../components/ListDetailPage/index';

const modelData = [];
/**
 * @Jimmery 
 * @description 商品审核页面
 * @date 2018/08/29
 */
const data = [
   {
       key: 1,
       title: '商品名称',
       content: '这个还是挺好的'
   },
   {
        key: 1,
        title: '商品名称',
        content: '这个还是挺好的'
    }  
  ];

  //审核列表
  const reviewDatasource = [
    {
        key: 1,
        title: '审核操作人',
        content: '超级管理员'
    },
    {
         key: 2,
         title: '审核时间',
         content: '2018-08-28 17:53:55'
     },
     {
        key: 3,
        title: '审核结果',
        content: '已通过'
    }    
   ];
@connect(({ list, reviewList, productList }) => ({
    list,
    reviewList,
    productList
}))
class shopReview extends Component {

    constructor(props) {
        super(props);

        this.modelColumn = [
            {
                title: '专属价',
                dataIndex: 'price',
                width: 30,
            }, {
                title: '采购商名称',
                dataIndex: 'enterprieName',
                width: 30,
            }, {
                title: '采购商账号',
                dataIndex: 'telphone',
                width: 100,
            },
        ];

        this.state = {
            tableWidth: 160
        }
    }

    //查询商品信息模态框
    searchProductInfo() {
        const { dispatch } = this.props;
        dispatch({
            type: 'reviewList/fetch',
            payload: {
              
            },
        });
    }

    //查询审核信息列表
    searchReview() {
        const { dispatch } = this.props;
        dispatch({
            type: 'reviewList/fetch',
            payload: {
              
            },
        }); 
    }

    //查询商品信息列表
    searchProductInfo() {
        const { dispatch } = this.props;
        dispatch({
            type: 'productList/fetch',
            payload: {
              
            },
        }); 
    }

    componentWillMount() {
        modelData.splice(0, 10);
        for(let count = 0; count < 10; count ++) {
            modelData.push({
                key: `${ count + 1 }`,
                price: `${count * 10}`,
                enterprieName: `集鲜丰${count}号`,
                telphone: `${(count + 1) * 100000000000}`
            })
        }

        //调用查询方法

    }

    render() {
        const { location } = this.props;
        const params = location.params;
        return (
            <div style={{ marginBottom: 100 }}>
                <div className="backTop">
                     <span className="backButton" onClick={() => this.props.history.goBack()}>
                         <Icon type="left" />&nbsp;返回上一页
                     </span>
                </div>
                <div className={styles.listMsg}>
                    <ListDetailPage data={data} title="商品信息"/>
                    <ResizTable dataSource={modelData} columns={this.modelColumn} width={this.state.modelWidth}/>
                </div>
                {/* 审核信息 */}
                <div className={styles.reviewInfo}>
                    <ListDetailPage data={reviewDatasource} title="审核信息"/>
                </div>
            </div>
        );
    }

}

export default shopReview;